Skip to content

Fix locale-safe UI scale input - #2099

Draft
Loggableim wants to merge 1 commit into
armory3d:mainfrom
Loggableim:fix/2082-ui-scale-locale
Draft

Loggableim wants to merge 1 commit into
armory3d:mainfrom
Loggableim:fix/2082-ui-scale-locale

Conversation

@Loggableim

Copy link
Copy Markdown

Summary

  • accept a decimal comma for numeric slider input without changing expressions
  • validate UI scale at config load, application, import, and save boundaries
  • add focused regression checks

Root cause

The editable UI Scale slider evaluated 1,5 as an expression rather than a decimal number, which could persist an invalid scale and prevent a later startup.

Validation

  • python paint/tests/test_issue_2082.py
  • Local native project generation is currently blocked by the bundled amake stack-overflow error; GitHub platform builds will provide compile validation.

Fixes #2082

@rahul05ranjan

Copy link
Copy Markdown

Good fix — decimal-comma locales breaking the UI scale input is a real papercut. The normalization helper is clear and the window-scale validation (clamping to 1.0–4.0) is a sensible guard against a corrupt config.

Two things:

  1. ui_normalize_numeric_text uses a static char normalized[1024] buffer. Static buffers in UI code are a re-entrancy hazard if this ever gets called from two places in the same frame. It's probably fine today (single-threaded UI), but a caller-provided buffer or a comment would make it safer.

  2. The config_validate_window_scale check if (!(scale >= 1.0 && scale <= 4.0)) — the !(scale >= 1.0) form also catches NaN, which is actually a nice touch. Just confirming that's intentional (it reads a bit unusual).

Otherwise LGTM.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

UI scale accepts negative values causing app to not start - locale issue with comma vs decimal point

2 participants